package org.wsff.tools.api.gateway.demo.validator;

import org.wsff.tools.api.gateway.core.AbstractProxyValidator;
import org.wsff.tools.api.gateway.core.Proxy;
import org.wsff.tools.api.gateway.demo.Apis;
import org.wsff.tools.api.gateway.demo.model.TestRequest;
import org.wsff.tools.api.gateway.error.ValidationException;

/**
 * ExampleTestProxy
 * @author ryan
 * @version Id: ExampleTestProxy.java, v 0.1 2022-04-02 10:17 ryan Exp $$
 */
@Proxy(id = Apis.EXAMPLE_TEST)
public class ExampleTestValidator extends AbstractProxyValidator<TestRequest> {

    /**
     * 执行业务校验
     *
     * @param testRequest 请求参数
     * @throws ValidationException 验证异常
     */
    @Override
    protected void doValidate(TestRequest testRequest) throws ValidationException {
        paramNotStringBlank(testRequest.getReason(), "reason");
        System.out.println("do validator");
    }
}
